<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.asaga.tools.*, java.util.*, java.io.*, java.net.*, java.util.*"%>
<%--
     Author:  Jeremy Sanderlin 
     Date Created: 2007-03-25
     Last Modified: 2006-03-25
     Last Modified By: Jeremy Sanderlin
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="userProfile" scope="session" class="com.asaga.tools.SystemClient_DBImpl" />
<% 
    String adminMenu = (String)session.getAttribute("adminMenu");
    AutismGroup autismGroup = (AutismGroup)session.getAttribute("autismGroup");
    TreeSet autismGroupMessageTreeSet = 
            (TreeSet)session.getAttribute("autismGroupMessageTreeSet");
    AutismGroupMessage autismGroupMessage = null;   
    Iterator iterator = null;
%>
<html>
    <%@ include file="header.jsp" %>
        <div id="container">
            <%@ include file="topNav.jsp" %>
            <%@ include file="leftside.jsp" %>
            <%@ include file="rightside.jsp" %>
            <div id="content">
                <h1>Group Forum Page</h1>
                <br />
                <hr />
                <br />
                        <table border="0" frame="box" > <!-- Outermost table -->
                            <tr> <!-- Menu Titles -->
                                <td> <!-- Group Menu Options-->
                                    <h3>Group Menu Options</h3>
                                </td> <!-- Group Menu Options-->
                            </tr> <!-- Menu Titles -->
                            <tr> <!--Outermost Table Data-->
                                 <td>
                                    <a href=AutismSiteMasterController?action=group&groupAction=listMembers&groupId=<%=autismGroup.GetGroupId()%>>
                                        List Group Members
                                    </a>
                                </td>    
                                <td>
                                    <a href=new_message.jsp?groupId=<%=autismGroup.GetGroupId()%>>
                                        Post a New Message
                                    </a>
                                </td> 
                                <td>
                                    <a href=AutismSiteMasterController?action=group&groupAction=leaveGroup&groupId=<%=autismGroup.GetGroupId()%>>
                                        End Group Membership
                                    </a>
                                </td>                                
                            </tr>
                            <tr>
                                <td colspan="3"><hr/></td>
                            </tr>
                        </table>
                        <td> <!-- Group Message Cell Data -->
                            <table border="0"> <!-- Group Message Sub-Table --> 
                                <% iterator = autismGroupMessageTreeSet.iterator();%>
                                <% if(!iterator.hasNext()){ %>
                                    <tr>
                                        <td>No Messages</td>
                                        <td>
                                            <a href=new_message.jsp?groupId=<%=autismGroup.GetGroupId()%>>
                                                Post New Message
                                            </a>                                        
                                        </td>                        
                                    </tr>
                                <% }else{%>
                                <% while(iterator.hasNext()){ %>
                                    <% autismGroupMessage = (AutismGroupMessage)iterator.next(); %>
                                    <tr>
                                        <td colspan="3">
                                            <a href=AutismSiteMasterController?action=group&groupAction=viewMessage&groupId=<%=autismGroup.GetGroupId()%>&messageId=<%=autismGroupMessage.GetMessageId()%>>
                                                <b>Subject: <%=autismGroupMessage.GetMessageSubject()%></b>
                                            </a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>Author:</b> <%=autismGroupMessage.GetPersonName()%>
                                        </td>
                                        <td>
                                            <b>Date Created:</b> <%=autismGroupMessage.GetTimeCreated()%>
                                        </td>
                                    </tr>
 
                                    <tr>                                    
                                        <td>
                                            <a href=reply_message.jsp?groupId=<%=autismGroup.GetGroupId()%>&messageId=<%=autismGroupMessage.GetMessageId()%>>
                                               Reply
                                            </a>                                        
                                        </td>
                                     <% if(adminMenu.equals("admin")){%>                                       
                                        <td>
                                            <a href=AutismSiteMasterController?action=group&groupAction=removeMessage&groupId=<%=autismGroup.GetGroupId()%>&messageId=<%=autismGroupMessage.GetMessageId()%>>
                                                Remove
                                            </a>
                                        </td>
                                        <% } %>                                       
                                    </tr> 
                                    <tr>
                                        <td colspan="3"><hr/></td>
                                    </tr>
                                    <% } %>
                                <%  }%>
                            </table> <!-- Group Message Sub-Table --> 
                        </td> <!--Group Message Cell Data -->
                    </tr> <!--Outermost Table Data-->
                </table> <!-- Outermost table -->
    
            </div>
            <%@ include file="footer.jsp" %>
        </div>
    </body>
</html>
